//
//  LTChooseUnitCell.m
//  LearnTeacher
//
//  Created by 高刘通 on 2024/6/7.
//

#import "LTChooseUnitCell.h"
#import "LTChooseUnitModel.h"

@interface LTChooseUnitCell()
@property(strong, nonatomic) UILabel *contentLabel;
@property(strong, nonatomic) UIView *lineView;
@end

@implementation LTChooseUnitCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.contentLabel];
        [self.contentView addSubview:self.lineView];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setModel:(LTChooseUnitModel *)model {
    _model = model;
    self.contentLabel.text = [NSString stringWithFormat:@"· %@", model.name];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.contentLabel.frame = CGRectMake(22, 0, self.contentView.width - 40, self.contentView.height);
    self.lineView.frame = CGRectMake(20, self.contentView.height - 0.5, self.contentView.width - 40, 0.5);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (UIView *)contentLabel {
    if (!_contentLabel) {
        _contentLabel = [UILabel new];
        _contentLabel.textColor = rgba(114, 122, 142, 1);
        _contentLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
    }
    return _contentLabel;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [UIView new];
        _lineView.backgroundColor = rgba(238, 238, 238, 1);
    }
    return _lineView;
}

@end


